package person.bing.fbcloud.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import person.bing.fbcloud.api.entity.PostCategory;
import person.bing.fbcloud.mapper.PostCategoryMapper;
import person.bing.fbcloud.service.PostCategoryService;

import java.time.LocalDateTime;

/**
 * <p>
 *  帖子类型
 * </p>
 *
 * @author mengfb
 * @since 2019-06-24
 */
@Service
public class PostCategoryServiceImpl extends ServiceImpl<PostCategoryMapper, PostCategory> implements PostCategoryService {

    @Override
    public void addCategory(String categoryKey, String categoryDesc) {
        LocalDateTime now = LocalDateTime.now();
        PostCategory postCategory = new PostCategory();
        postCategory.setCategoryKey(categoryKey);
        postCategory.setCategoryDesc(categoryDesc);
        postCategory.setCreateTime(now);
        postCategory.setUpdateTime(now);
        this.save(postCategory);
    }
}
